package com.company.module.net.interceptor;//package com.company.app.common.http.interceptor;
//
//import android.content.Context;
//import android.util.Log;
//
//import java.io.IOException;
//
//import okhttp3.Interceptor;
//import okhttp3.Response;
//import sixbing.com.interviewone.base.BaseApplication;
//
///**
// * Created by drore on 17/3/16.
// */
//
//public class SaveCookiesInterceptor implements Interceptor {
//    private String TAG = "SaveCookiesInterceptor";
//
//    @Override
//    public Response intercept(Chain chain) throws IOException {
//        Response originalResponse = chain.proceed(chain.request());
//
//        if (!originalResponse.headers("request-token").isEmpty()) {
//            Log.e(TAG, "SaveCookiesInterceptor success");
//            String cookies = "";
//            for (String header : originalResponse.headers("request-token")) {
//                cookies = header;
//            }
//            BaseApplication.getInstance().getSharedPreferences("cookie", Context.MODE_PRIVATE).edit().clear().putString("request-token", cookies).apply();
//        }else {
//            Log.e(TAG, "SaveCookiesInterceptor error");
//        }
//
//        return originalResponse;
//    }
//}
